package com.payutil;


import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class MyWXPayConfig extends WXPayConfig {
    
     private byte[] certData;
 
//   public MyWXPayConfig() throws Exception {
//        String certPath = "c:/Users/Administrator/Desktop/1564439721_20210205_cert/apiclient_cert.p12";
//        File file = new File(certPath);
//        InputStream certStream = new FileInputStream(file);
//        this.certData = new byte[(int) file.length()];
//        certStream.read(this.certData);
//        certStream.close();
//    }

    @Override
    public String getAppID() {
        // TODO Auto-generated method stub
        return "wx4c1b026545f7722f";//
    }

    @Override
    public String getMchID() {
        // TODO Auto-generated method stub
        return "1564439721";//商户编号
    }

    @Override
    public String getKey() {//商户平台密钥
        // TODO Auto-generated method stub
        return "z7zE4bHpYkjgAIntcog7iVErHYi6ppgZ";
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        // TODO Auto-generated method stub
         return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
           return 10000;
    }

    @Override
    IWXPayDomain getWXPayDomain() {
        // TODO Auto-generated method stub 
        return new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {
            }
            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new IWXPayDomain.DomainInfo(WXPayConstants.DOMAIN_API, true);
            }
        };
    }

}